<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="ex" uri="/WEB-INF/taglib/widget-ComboBox.tld"%>

<%@ include file="header.jsp"%>
		<div class="flex-container">
			<%@ include file="leftmenu.jsp"%>
			<div class="right-container" style="overflow: auto">
			    <div class="right_content" style="overflow: auto">
			    	<div class="header">
			    		<img src="images_c/location.png" />
			    		<h6>首页<span class="relation_symbol">></span>创客管理<span class="relation_symbol">></span><span class="relation_color">创客信息审核</span></h6>
			    	</div>
			    	<ul class="row tab_block">
			    		<li class="active_li">企业审核</li>
			    		<li>个人审核</li>
			    	</ul>
			    	<div class="tab_content" id="tab_content_enterprise">
			    		<div class="row search_block">
							<form action="/makers/audit" method="post" id="companyForm">
								<label class="search_name">公司名称</label>
								<input class="search_box1" name="usercp" type="text"/>
								<label class="search_name">用户名</label>
								<input class="search_box1" name="username" type="text"/>
								<label class="search_name">联系人</label>
								<input class="search_box1" name="linkman" type="text"/>

								<label class="search_name">状态</label>
								<ex:combobox style="flex: 1 1 auto;-webkit-flex: 1 1 auto;-ms-flex: 1 1 auto;-moz-box-flex: 1 1 auto; height: 30px;border: 1px solid #c9c9c9;padding-left: 20px;	margin-right: 15px;"
											 model="${combo_status}" id="userstatus" name="userstatus"></ex:combobox>
								<label class="search_name">审核状态</label>
								<ex:combobox style="flex: 1 1 auto;-webkit-flex: 1 1 auto;-ms-flex: 1 1 auto;-moz-box-flex: 1 1 auto; height: 30px;border: 1px solid #c9c9c9;padding-left: 20px;	margin-right: 15px;"
											 model="${combo_check}" id="usercheck" name="usercheck"></ex:combobox>
								<input type="hidden" id="companyPage" name="currentPage" value="1">
                                <input type="hidden" id="usergtype" name="usergtype" value="1"/>
								<a href="javascript:void(0)" onclick="searchCompanyInput()" class="search_btn">查询</a>
							</form>
				    	</div>
				    	<div class="row table_container">
				    		<div class="row search_result">
				    			<div class="search_result_left">
				    				<div class="search_result_icon"></div>
				    			    <p class="search_result_label">查询结果</p>
				    			</div>
				    			<div class="search_result_right">
				    				<img src="images_c/icon1.png" />
				    				<span>审核通过</span>
				    				<img src="images_c/icon2.png" />
				    				<span>审核不通过</span>
				    				<img src="images_c/icon3.png" />
				    				<span>启用</span>
				    				<img src="images_c/icon4.png" />
				    				<span>停用</span>
				    			</div>
				    		</div>
<<<<<<< .working
				    		<div class="table_block" id="vue_cp_list">
					    		<table class="table table-center table-striped table-bordered table-hover" style="table-layout:fixed;"
								cellspacing="0" width="100%">
||||||| .merge-left.r187
				    		<div class="table_block" id="vue_cp_list">
					    		<table class="table table-center table-striped table-bordered table-hover">
=======
				    		<div class="table_block">
					    		<table class="table table-center table-striped table-bordered table-hover" style="table-layout:fixed;"
								cellspacing="0" width="100%">
>>>>>>> .merge-right.r88
					    			<thead>
					    				<tr>
					    					<th>公司名称</th>
					    					<th>用户名</th>
					    					<th>联系人</th>
					    					<th>手机号码</th>
					    					<th>邮箱</th>
					    					<th>是否入驻</th>
					    					<th>状态</th>
					    					<th>审核状态</th>
					    					<th>注册时间</th>
					    					<th>操作</th>
					    				</tr>
					    			</thead>
					    			<tbody id="companyTBody">
					    			</tbody>
					    		</table>
								<div id="companyPager"></div>
					    	</div>
				    	</div>
				    	
				    	<!--弹窗开始-->
				    	<div class="background" id="companyBackground" style="display: none;">
				    		<div class="tanchuang" style="width: 700px;">
				    		    <div class="tanchuang_header">
				    		    <div class="tanchuang_title">
									<img src="images_c/tanchuang_chaxun.png" />
									<p class="tanchuang_title_name">企业创客信息</p>
								</div>
								<img src="images_c/tanchuang_close.png" class="close"/>
								
								</div>
								<div class="tanchuang_line"></div>
								<div class="tanchuang_content" id="vue_cp_detail">
									<form class="form_content_block">
										<div class="form_group">
											<label class="tanchuang_label">公司名称</label>
											<input type="text" v-model="baseInfo.usercp" class="tanchuang_input"/>
										</div>
										<div class="form_group">
											<label class="tanchuang_label">企业法人姓名</label>
											<input type="text" v-model="realInfo.zname" class="tanchuang_input"/>
										</div>
										<div class="form_group">
											<label class="tanchuang_label">企业成立日期</label>
											<input type="text" v-model="realInfo.ctime" class="tanchuang_input"/>
										</div>
										<div class="form_group">
											<label class="tanchuang_label">营业执照注册号</label>
											<input type="text" v-model="realInfo.busnum" class="tanchuang_input"/>
										</div>
										<div class="form_group">
											<label class="tanchuang_label">组织机构代码</label>
											<input type="text" v-model="realInfo.orgnum" class="tanchuang_input"/>
										</div>
									</form>
									<div class="btn_group_save">
										<a class="save_btn">保存</a>
										<a class="save_btn" id="cancel_btn">取消</a>
									</div>
									
								</div>
							</div>
						</div>
						<!--弹窗结束-->
							
			    	</div>
			    	<div class="tab_content" id="tab_content_person" style="display: none;">
			    		<div class="row search_block">
							<form action="/makers/audit" method="post" id="personForm">
								<label class="search_name">公司名称</label>
								<input class="search_box1" name="usercp" type="text"/>
								<label class="search_name">用户名</label>
								<input class="search_box1" name="username" type="text"/>
								<label class="search_name">联系人</label>
								<input class="search_box1" name="linkman" type="text"/>

								<label class="search_name">状态</label>
								<ex:combobox style="flex: 1 1 auto;-webkit-flex: 1 1 auto;-ms-flex: 1 1 auto;-moz-box-flex: 1 1 auto; height: 30px;border: 1px solid #c9c9c9;padding-left: 20px;	margin-right: 15px;"
											 model="${combo_status}" id="userstatus" name="userstatus"></ex:combobox>
								<label class="search_name">审核状态</label>
								<ex:combobox style="flex: 1 1 auto;-webkit-flex: 1 1 auto;-ms-flex: 1 1 auto;-moz-box-flex: 1 1 auto; height: 30px;border: 1px solid #c9c9c9;padding-left: 20px;	margin-right: 15px;"
											 model="${combo_check}" id="usercheck" name="usercheck"></ex:combobox>
								<input type="hidden" id="personPage" name="currentPage" value="1">
                                <input type="hidden" id="usergtype" name="usergtype" value="0"/>
								<a href="javascript:void(0)" onclick="searchPersonInput()" class="search_btn">查询</a>
							</form>
				    	</div>
				    	<div class="row table_container">
				    		<div class="row search_result">
				    			<div class="search_result_left">
				    				<div class="search_result_icon"></div>
				    			    <p class="search_result_label">查询结果</p>
				    			</div>
				    			<div class="search_result_right">
				    				<img src="images_c/icon1.png" />
				    				<span>审核通过</span>
				    				<img src="images_c/icon2.png" />
				    				<span>审核不通过</span>
				    				<img src="images_c/icon3.png" />
				    				<span>启用</span>
				    				<img src="images_c/icon4.png" />
				    				<span>停用</span>
				    			</div>
				    		</div>
				    		<div class="table_block">
					    		<table class="table table-center table-striped table-bordered table-hover"
								cellspacing="0" width="100%">
									<thead>
									<tr>
										<th>公司名称</th>
										<th>用户名</th>
										<th>联系人</th>
										<th>手机号码</th>
										<th>邮箱</th>
										<th>是否入驻</th>
										<th>状态</th>
										<th>审核状态</th>
										<th>注册时间</th>
										<th>操作</th>
									</tr>
									</thead>
					    			<tbody id="personTBody">
					    			</tbody>
					    		</table>
								<div id="personPager"></div>
					    	</div>
				    	</div>
				    	
				    	<!--弹窗开始-->
				    	<div class="background" id="personBackground" style="display: none;">
				    		<div class="tanchuang" style="width: 700px;">
				    		    <div class="tanchuang_header">
				    		    <div class="tanchuang_title">
									<img src="images_c/tanchuang_chaxun.png" />
									<p class="tanchuang_title_name">个人创客信息查询</p>
								</div>
								<img src="images_c/tanchuang_close.png" class="close"/>
								
								</div>
								<div class="tanchuang_line"></div>
							    <div class="tanchuang_content" id="vue_ps_detail">
									<form class="form_content_block">
										<div class="form_group">
											<label class="tanchuang_label">用户名</label>
											<input type="text" v-model="baseInfo.username" class="tanchuang_input"/>
										</div>
										<div class="form_group">
											<label class="tanchuang_label">真实姓名</label>
											<input type="text" v-model="realInfo.zname" class="tanchuang_input"/>
										</div>
										<div class="form_group">
											<label class="tanchuang_label">性别</label>
											<input type="text" v-model="baseInfo.legalsex" class="tanchuang_input"/>
										</div>
										<div class="form_group">
											<label class="tanchuang_label">身份证</label>
											<input type="text" v-model="realInfo.crnum" class="tanchuang_input"/>
										</div>
										<div class="form_group">
											<label class="tanchuang_label">电话</label>
											<input type="text" v-model="baseInfo.usertel" class="tanchuang_input"/>
										</div>
									</form>
								
									<div class="btn_group_save">
										<a class="save_btn">保存</a>
										<a class="save_btn" id="cancel_btn">取消</a>
									</div>
								</div>
								
							</div>
						</div>
						<!--弹窗结束-->
			    	</div>
			    </div>
		    </div>
		</div>
	</body>
	<script>
		$(document).ready(function(){
            searchCompanyInput();
            searchPersonInput();
			$(".tab_block>li").click(function(){
				$(this).addClass('active_li');
                $(this).siblings().removeClass('active_li');
                var num=$(this).index();
                $('.tab_content').hide();
                $('.tab_content').eq(num).show();
			});

			$('.close').click(function() {
				$('.background').fadeOut();
			});
			$('#cancel_btn').click(function(){
				$('.background').fadeOut();
			});
		})
	</script>

<script type="text/javascript">
    vm_cp = new Vue({
        el: '#vue_cp_detail',
        data: {
            baseInfo:{},
            realInfo: {}
        }
    });
    vm_ps = new Vue({
        el: '#vue_ps_detail',
        data: {
            baseInfo:{},
            realInfo: {}
        }
    });
    function hunterPageContrlNextJump(jumpFunc){
        var jumpPageNumber=document.getElementById('pagerNum').value;
        if(jumpPageNumber==''){
            alert('未输入页码！');
            jumpFunc(1);
            return;
        }
        var lastPageNumber=Number(document.getElementById('pagerAll').value);
        if((!Number(jumpPageNumber))){
            alert('输入错误,只能输入数值！');
            jumpFunc(1);
            return;
        }
        if(Number(jumpPageNumber)<1){
            alert('输入错误,只能输入正数！');
            jumpFunc(1);
            return;
        }
        if(Number(jumpPageNumber)<=Number(lastPageNumber)){
            jumpFunc(Number(jumpPageNumber));
        }else{alert('超过最大页数！');
            jumpFunc(1);
        }
    }

    function createPager(divid, page, nextPageFunc) {
        var htmlStr = "<div id=\"page\" class=\"kkpager\">";
        if(page.totalResult > 0) {
            htmlStr = htmlStr + "	<div><span class=\"pageBtnWrap\">\n";
            htmlStr = htmlStr + "<span class=\"btn\"  disabled='disabled' style=\"float:right;clear:both;\">总数：<span class=\"currPageNum\">" + page.totalResult + "</span></span>\n";
            if (page.currentPage == 1) {
                htmlStr += "	<span class=\"btn btn-default\" disabled='disabled'>首页</span><span class=\"btn btn-default\" disabled='disabled'>上页</span>\n";
            } else {
                htmlStr += "	<span  class=\"btn btn-default\"  href=\"#@\" onclick=\"" + nextPageFunc + "(1)\">首页</span>\n";
                htmlStr += "	<span  class=\"btn btn-default\"  href=\"#@\" onclick=\"" + nextPageFunc + "(" + (page.currentPage - 1) + ")\">上页</span>\n";
            }
            var showTag = 5;	//分页标签显示数量
            var startTag = 1;
            var endTag;
            if (page.currentPage <= 3) {
                startTag = 1;
                endTag = showTag;
            } else {
                startTag = page.currentPage - 2;
                endTag = startTag + showTag - 1;
            }
            for (var i = startTag; i <= page.totalPage && i <= endTag; i++) {
                if (page.currentPage === i)
                    htmlStr += "<span class=\"btn\">" + i + "</span>\n";
                else
                    htmlStr += "	<span class=\" text-muted btn btn-default\"  onclick=\"" + nextPageFunc + "(" + i + ")\">" + i + "</span>\n";
            }
            if (page.currentPage === page.totalPage) {
                htmlStr += "	<span class=\"btn btn-default\" disabled='disabled'>下页</span>\n";
                htmlStr += "	<span class=\"btn btn-default\" disabled='disabled'>尾页</span></span>\n";
            } else {
                htmlStr += "	<span  class=\"btn btn-default\"  href=\"#@\" onclick=\"" + nextPageFunc + "(" + (page.currentPage + 1) + ")\">下页</span>\n";
                htmlStr += "	<span  class=\"btn btn-default\"  href=\"#@\" onclick=\"" + nextPageFunc + "(" + page.totalPage + ")\">尾页</span></span>\n";
            }
            htmlStr += "<span class=\"infoTextAndGoPageBtnWrap\"><span class=\"totalText\" style=\"line-height:30px\">共<span class=\"currPageNum\">" + page.totalPage + "</span>页</span>\n";
            htmlStr += " <span class=\"goPageBox\" style=\" float:right\">&nbsp;<span id=\"kkpager_gopage_wrap\"><input type=\"text\" class=\"kkpager_btn_go_input\"  value=\"\" id='pagerNum' style=\"height:22px\"></span>页</span><span href=\"#\" class=\"btn btn-primary btn-sm\" onclick=\"hunterPageContrlNextJump(" + nextPageFunc + ")\">转到</span></span></div><div style=\"clear:both;\"></div></div>\n";
            htmlStr += " <input type='hidden' id='pagerAll' value='" + page.totalPage + "'/> \n";
            var pager = $("#" + divid);
            if( pager !== null && pager != '') {
                pager.html(htmlStr);
            }
        }
    }
    function createTR(makerInfo, showEditModel) {
        var len = makerInfo.length;
        var tableStr = '';
        for ( var i = 0; i < len; i++) {
            tableStr =  tableStr + '<tr>'
                + '<td>' + makerInfo[i].usercp + '</td>'
                + '<td>' + makerInfo[i].username + '</td>'
                + '<td>' + makerInfo[i].linkman + '</td>'
                + '<td>' + makerInfo[i].usertel + '</td>'
                + '<td>' + makerInfo[i].usermail + '</td>'
                + '<td>' + makerInfo[i].userrz + '</td>'
                + '<td>' + makerInfo[i].userstatus + '</td>'
                + '<td>' + makerInfo[i].usercheck + '</td>'
                + '<td>' + makerInfo[i].createtime + '</td>'
                + '<td><span class="shenhe" id = "companyEditor" onclick="'+ showEditModel + '(\'' + makerInfo[i].userid + '\')">编辑</span></td>'
                + '</tr>';
        }
        return tableStr;
    }
    function showCompanyEditModel(userid){
        $.get("/makers/getCpMakerInfo", {userid: userid}, function(data) {
            var data = JSON.parse(data);
            vm_cp.baseInfo = data.baseInfo;
            vm_cp.realInfo = data.realInfo;
        });
        $("#companyBackground").fadeIn();
    };
    function nextCompanyPage(num) {
        $('#companyPage').attr('value', num);
        doCompanySearch();
    }

    function searchCompanyInput() {
        $('#companyPage').attr('value', 1);
        doCompanySearch();
    }
    function doCompanySearch(){
        $.post("/makers/audit",$("#companyForm").serialize(), function (data) {
            var data = JSON.parse(data);
            var makerInfo = data.makerInfo;
            var tableStr = createTR(makerInfo, 'showCompanyEditModel');
            $("#companyTBody").html(tableStr);
            createPager("companyPager", data.page, 'nextCompanyPage');
        });
    }
    function OnCompanyValueChanged(event) {
        var e = event || window.event || arguments.callee.caller.arguments[0];
        if(e && e.keyCode==13){ // enter 键
            searchCompanyInput();
        }
    }

    function nextPersonPage(num) {
        $('#personPage').attr('value', num);
        doPersonSearch();
    }
    function searchPersonInput() {
        $('#personPage').attr('value', 1);
        doPersonSearch();
    }
    function showPersonEditModel(userid){
        $.get("/makers/getPsMakerInfo", {userid: userid}, function(data) {
            var data = JSON.parse(data);
            vm_ps.baseInfo = data.baseInfo;
            vm_ps.realInfo = data.realInfo;
        });
        $("#personBackground").fadeIn();
    };
    function doPersonSearch() {
        $.post("/makers/audit",$("#personForm").serialize(), function (data) {
            var data = JSON.parse(data);
            var makerInfo = data.makerInfo;
            var tableStr = createTR(makerInfo, 'showPersonEditModel');
            $("#personTBody").html(tableStr);
            createPager("personPager", data.page, 'nextPersonPage');
        });
    }
    function OnPersonValueChanged(event) {
        var e = event || window.event || arguments.callee.caller.arguments[0];
        if(e && e.keyCode==13){ // enter 键
            searchPersonInput();
        }
    }
</script>
</html>